#ifndef _INPUT_MANAGER_H_
#define _INPUT_MANAGER_H_

#include <map>

class InputManager
{
public:
	InputManager(const sf::Input& input);
	void mapInput(const SQChar* input, SquirrelObject& hit, SquirrelObject& release);
	void onEvent(sf::Event& ev);
	bool isMouseDown(int button) const;
	bool isKeyDown(const SQChar* key) const;
	bool isJoyDown(unsigned int JoyId, unsigned int Button) const;
	unsigned int mouseX() const;
	unsigned int mouseY() const;
private:
	struct compare
	{
		bool operator()(const SQChar* a,const SQChar* b) const
		{
			return wcscmp(a,b)<0;
		}
	};
	std::map<sf::Key::Code,const SQChar*> keydict;
	mutable std::map<const SQChar*,sf::Key::Code,compare> keydict2;
	std::map<sf::Key::Code,SquirrelObject> key_hit;
	std::map<sf::Key::Code,SquirrelObject> key_release;
	std::map<wstring,SquirrelObject> inputmap_hit;
	std::map<wstring,SquirrelObject> inputmap_release;
	const sf::Input& input;
};

#endif